<%--
  Created by IntelliJ IDEA.
  User: 86137
  Date: 2021/11/1
  Time: 9:53
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="viewport" content="width-device-width, initial-scale=1.0">
    <link rel="stylesheet" href="resource/css/bootstrap.css">
    <script type="text/javascript" src="resource/js/jquery-3.2.1.js"></script>
    <script type="text/javascript" src="resource/js/bootstrap.js"></script>
    <title>Title</title>
</head>
<body>
    <form action="list" method="post">
        <input type="hidden" name="pageNum">
        <table class="table">
            <tr>
                <td colspan="22">
                    <select name="types">
                        <option value="">===请选择===</option>
                        <option value="name" ${vo.types=='name'?'selected':''}>姓名</option>
                        <option value="unit" ${vo.types=='unit'?'selected':''}>申请注册单位</option>
                    </select>
                    <input type="text" name="neiRong" value="${vo.neiRong}">
                    职业资格证书编号:
                    <input type="text" name="serialNum" value="${vo.serialNum}">
                    有效期:
                    <input type="date" name="date1" value="<fmt:formatDate value="${vo.date1}" pattern="yyyy-MM-dd"></fmt:formatDate>">至
                    <input type="date" name="date2" value="<fmt:formatDate value="${vo.date2}" pattern="yyyy-MM-dd"></fmt:formatDate>">
                    <input type="submit" value="查询" class="btn btn-success"><br>
                    <input type="button" value="批量删除" onclick="delAll()" class="btn btn-danger">
                </td>
            </tr>
            <tr>
                <th>
                    <input type="checkbox" onclick="choose(this.checked)">
                </th>
                <th>编号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>省市</th>
                <th>申请注册单位</th>
                <th>会计师分类编号</th>
                <th>职业资格证书编号</th>
                <th>注册号</th>
                <th>有效期</th>
                <th>
                    操作
                    <a href="toAdd">新增</a>
                </th>
            </tr>
            <c:forEach var="a" items="${info.list}">
                <tr>
                    <td>
                        <input type="checkbox" value="${a.id}" class="a">
                    </td>
                    <td>${a.id}</td>
                    <td>${a.name}</td>
                    <td>${a.gender}</td>
                    <td>${a.city}</td>
                    <td>${a.unit}</td>
                    <td>${a.aid}</td>
                    <td>${a.serialNum}</td>
                    <td>${a.registerNum}</td>
                    <td><fmt:formatDate value="${a.dates}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                    <td>
                        <a href="">编辑</a>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="22">
                    <jsp:include page="/resource/common/pages.jsp"></jsp:include>
                </td>
            </tr>
        </table>
    </form>

    <script type="text/javascript">
        function goPage(pageNum){
            $("[name='pageNum']").val(pageNum);
            $("form").submit();
        }

        //全选
        function choose(thiz){
            $(".a").attr("checked",thiz);
        }

        //批删
        function delAll(){
            var ids = $(".a:checked").map(function (){
                return this.value;
            }).get().join();

            if (ids.length > 0){
                $.post(
                    "delAll",
                    {ids:ids},
                    function (msg){
                        if (msg > 0){
                            alert("删除成功");
                            location="list";
                        }
                    }
                )
            }else{
                alert("请选择数据");
            }
        }
    </script>
</body>
</html>
